[lua] Add support for lua 5.5#12867
[lua] Add support for lua 5.5#12867tobil4sk wants to merge 8 commits intoHaxeFoundation:developmentfrom
Conversation
|
A few things I noticed:
Also — what's the plan for the hx-lua-simdjson dependency? Is that close to being merged, or does this PR need to wait on it? |
This is what gives 5.5 compat but causes a crash in edge cases: starwing/luautf8@38b1541, and this is the bug fix that fixes the crash: starwing/luautf8#60
The hx-lua-simdjson PR should be ready to merge |
|
Tested luautf8 0.2.1 locally — you're right, the bump is safe. Confirmed that 0.1.7 crashes on Good to know about the cosh/sinh/tanh/log10 situation — makes sense to handle them here since they follow the same deprecation→removal pattern as atan2. |
|
I handled the other deprecations as suggested. I also hid the 2nd atan argument when explicitly targeting 5.1/5.2 and luajit, though it is still exposed for untargeted builds. |
In lua 5.3, math.atan2 was deprecated in favour of a two argument version of math.atan. In 5.5, math.atan2 has finally been removed so if atan2 is missing at runtime we should use atan instead. If 5.3 is targetted explicitly, we can assume that atan will take two arguments so we don't have to do a runtime check.
Lua 5.5 requires 0.1.7+, but 0.1.7 to 0.2.0 have a bug with invalid arguments to utf8.char. 0.2.1 gives 5.5 support and fixes the argument issue.
These were deprecated in 5.3 but still exist even in lua 5.5.
The exponent operator is available in all supported lua versions so we can use that instead. math.pow is deprecated in lua 5.3 and removed in lua 5.5.
When targetting these versions we know that atan2 is available so we can use it directly.
6b0e5d3 to
edf4486
Compare
|
Is this safe to merge? |
|
I think it should be, if the version handling looks good to you now? |
jdonaldson
left a comment
There was a problem hiding this comment.
Version handling looks good. Verified against local Lua 5.5:
atan2,cosh,sinh,tanh,pow,log10— confirmed absent in 5.5, correctly guardedfrexp,ldexp— confirmed still present in 5.5, correctly just deprecatedatansignature split and runtime??fallback for unversioned builds is cleanpow→^operator is the right move (works everywhere)
LGTM.
|
@Simn do you want to give this one final sniff and do the honors? I believe it's an improvement for handling runtime variants across the Lua target versions. |
Requires: HaxeFoundation/hx-lua-simdjson#4